Replication Code and Data for "The Politics of Pessimism: Unfunded Public Goods as a Source of Right-Wing Population"
Authors: Torben Iversen, Alice Xu
Contact email: alicezxu@upenn.edu
Date: November 22, 2024

All necessary code and files needed to replicate the tables and figures in the main text and in the Online Appendix are contained in this replication package, with the exception of the Gallup U.S. Tracker Polls files which is proprietary data made available by Gallup. The Code folder includes all replication code for the analyses in the main text or Online Appendix. The authors used StataMP 18 and R (version 4.4.2) to conduct the analyses in this paper. 

Replication files:
- CPS_fig5_mainresults_educ.do: reproduces main results in Figure 5 
- CPS_figA6.do: reproduces results in Figure 6
- CPS_figA7.do: reproduces results in Figure 7
- CPS_figA1_maps.R: reproduces map (Figure A1) in Appendix A
- CPS_figA3.do: reproduces results from placebo test in Figure A3
- CPS_figA4.do: reproduces results from placebo test in Figure A4
- CPS_figA5.do: reproduces results in Figure A5
- CPS_figA6.do: reproduces results in Figure A6
- CPS_figA7.do: reproduces results in Figure A7
- CPS_figA8.do: reproduces results in Figure A8
- CPS_figA9.do: reproduces results in Figure A9
- CPS_TrumpPessimism_figures.R: reproduces other figures in the paper. 

Codebook: 
- state: U.S. state
- start_date: COVID start date (i.e., first COVID case) in the state
- state_code: U.S. state acronym
- state_of_emergency: date of state declaration of state of emergency
- closed_k12: date of closing for K-12 schooling for the state
- ban_nursing_visitors: date of state ban of nursing visitors
- shelter: date of shelter-in-place policy
- shelter_end: date for end of shelter-in-place policy
- closed_business: date of state business closure mandates
- mask_mandate: date of state mask mandates
- after_lock: indicator variable for after lockdown policy
- after_mask: indicator variable for after mask mandates
- after_emergency: indicator variable for after state of emergency declaration
- after_k12: indicator variable for after closing for K-12 schooling
- after_business: indicator variable for after business closure mandates
- cumulative_cases: state's cumulative COVID cases
- Trump_pct_2016: state's percent share supporting Donald Trump
- non_teleworkable_emp: percent share in non-tele workable employment
- firstcase: date of first COVID case
- colgrad_perc: percent share of the population college-educated
- essential_workers_perc: percent share essential workers 
- popestimate2019: state population estimate (in 2019)
- share_female: percent share women
- share_black: percent share black
- share_hispanic: percent share Hispanic
- share_asian_hawaii_pacific: percent share Asian, Hawaiian, Pacific Islander
- mean_age: mean age of population 
- unemployment_rate: Unemployment rate
- gdp_percapita_millions: GDP per capita (in millions)
- gdp_percapita_thousands: GDP per capita (in thousands) 

Data sets:
- CPS_trumppolls_final.dta: This is the main dataset used in the paper. 
- state_businessmandates.dta data set on the timing of state business closure policies. Used to produce Figures 3 and 4 (see CPS_TrumpPessimism_figures.R).  

Notes: 
- Table A4: Can be replicated using the same code as Figure 5 (Main Results) by running lines 1 - 171 in CPS_fig5_mainresults_educ.do. 
- Data corresponding to code in CPS_tbl1_negexpectations.do omitted, because data is proprietary. No medications to the proprietary data set were made before data analysis. To procure the Gallup Daily Tracker Polls, a subscription to Gallup Analytics is required. See here for more information about the data set and how to procure access:
	-https://www.gallup.com/224855/gallup-poll-work.aspx
	-https://www.gallup.com/analytics/213617/gallup-analytics.aspx
Check to see if your institution has a license for access. The authors accessed this proprietary dataset using a license from Harvard Library; see here for more information: https://guides.library.harvard.edu/public_opinion/gallupmicro#s-lg-box-27653565. 

